<template>
	<view class="doctor-container">
		<scroll-view class="scroll-view_H" scroll-y="true">
			<view v-if="results.length>0" class="flex flex-column">
				<view class="item flex align-center justify-between" v-for="(item,index) in results" :key="index"
					@click="toDetail(item)">
					<text class="f-s-30">{{item.detailName}}</text>
					<img style="width: 40rpx;" src="@/static/images/arrow-right.svg" alt="">
				</view>
			</view>
			<view v-else class="flex align-center justify-center" style="height: 100%;">
				<u-empty mode="data">
				</u-empty>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import {
		getFunctionList
	} from "@/api/home/home.js";
	import {
		getDictType
	} from "@/api/system/public.js";
	export default {
		data() {
			return {
				id: '',
				menuCode: '',
				results: [],
			}
		},
		onLoad: function(res) {
			this.id = res.id
			this.menuCode = res.menuCode
			uni.setNavigationBarTitle({
				title: res.listName || '列表'
			});
			this.getDataSon()
		},
		methods: {
			/* 获取子列表 */
			getDataSon(id) {
				getFunctionList({
					id: this.id,
					parentId: this.id,
					detailType: '1',
					menuCode: this.menuCode
				}).then(res => {
					this.results = res.rows
				});
			},
			toDetail(res) {
				console.log(res)
				uni.setStorageSync('currentTrends', JSON.stringify(res.detailContent))
				uni.navigateTo({
					url: '/pages/home/menuSonDetail?menuName=' + res.detailName
				})
			}

		}
	}
</script>

<style scoped lang="scss">
	page {
		height: 100%;

		.doctor-container {
			width: 100%;
			height: 100%;
			position: relative;
			background-color: #F6F7F9;

			.scroll-view_H {
				width: 100%;
				height: 100%;


				.item {
					width: 94%;
					margin-left: 3%;
					padding: 24rpx 30rpx;
					border-bottom: 1px solid #eeeeee;
				}
			}

		}

	}
</style>